using System;
using System.Windows.Forms;
using System.Drawing;

namespace HIS
{
    public class MedicalRecordForm : Form
    {
        private TabControl tabControl;
        private TabPage tabVisit;
        private TabPage tabFollowUp;

        public MedicalRecordForm()
        {
            InitializeComponents();
        }

        private void InitializeComponents()
        {
            // 窗体设置
            this.Text = "门诊病历";
            this.Size = new Size(1000, 700);
            this.StartPosition = FormStartPosition.CenterScreen;

            // 创建选项卡控件
            tabControl = new TabControl
            {
                Location = new Point(20, 20),
                Size = new Size(960, 660)
            };

            // 就诊病历选项卡
            tabVisit = new TabPage("就诊病历");
            InitializeVisitTab();

            // 随访病历选项卡
            tabFollowUp = new TabPage("随访病历");
            InitializeFollowUpTab();

            // 添加选项卡
            tabControl.TabPages.AddRange(new TabPage[] {
                tabVisit,
                tabFollowUp
            });

            // 添加控件到窗体
            this.Controls.Add(tabControl);
        }

        private void InitializeVisitTab()
        {
            // 主诉区域
            GroupBox gbChiefComplaint = new GroupBox
            {
                Text = "主诉",
                Location = new Point(10, 10),
                Size = new Size(940, 80)
            };

            TextBox txtChiefComplaint = new TextBox
            {
                Location = new Point(10, 25),
                Size = new Size(920, 45),
                Multiline = true
            };

            gbChiefComplaint.Controls.Add(txtChiefComplaint);

            // 现病史区域
            GroupBox gbPresentIllness = new GroupBox
            {
                Text = "现病史",
                Location = new Point(10, 100),
                Size = new Size(940, 100)
            };

            TextBox txtPresentIllness = new TextBox
            {
                Location = new Point(10, 25),
                Size = new Size(920, 65),
                Multiline = true
            };

            gbPresentIllness.Controls.Add(txtPresentIllness);

            // 既往史区域
            GroupBox gbPastHistory = new GroupBox
            {
                Text = "既往史",
                Location = new Point(10, 210),
                Size = new Size(940, 100)
            };

            TextBox txtPastHistory = new TextBox
            {
                Location = new Point(10, 25),
                Size = new Size(920, 65),
                Multiline = true
            };

            gbPastHistory.Controls.Add(txtPastHistory);

            // 体检区域
            GroupBox gbPhysicalExam = new GroupBox
            {
                Text = "体检",
                Location = new Point(10, 320),
                Size = new Size(940, 100)
            };

            TextBox txtPhysicalExam = new TextBox
            {
                Location = new Point(10, 25),
                Size = new Size(920, 65),
                Multiline = true
            };

            gbPhysicalExam.Controls.Add(txtPhysicalExam);

            // 辅助检查区域
            GroupBox gbAuxiliaryExam = new GroupBox
            {
                Text = "辅助检查",
                Location = new Point(10, 430),
                Size = new Size(940, 80)
            };

            TextBox txtAuxiliaryExam = new TextBox
            {
                Location = new Point(10, 25),
                Size = new Size(920, 45),
                Multiline = true
            };

            gbAuxiliaryExam.Controls.Add(txtAuxiliaryExam);

            // 诊断区域
            GroupBox gbDiagnosis = new GroupBox
            {
                Text = "诊断",
                Location = new Point(10, 520),
                Size = new Size(940, 80)
            };

            TextBox txtDiagnosis = new TextBox
            {
                Location = new Point(10, 25),
                Size = new Size(920, 45),
                Multiline = true
            };

            gbDiagnosis.Controls.Add(txtDiagnosis);

            // 处理区域
            GroupBox gbTreatment = new GroupBox
            {
                Text = "处理",
                Location = new Point(10, 610),
                Size = new Size(940, 80)
            };

            TextBox txtTreatment = new TextBox
            {
                Location = new Point(10, 25),
                Size = new Size(920, 45),
                Multiline = true
            };

            gbTreatment.Controls.Add(txtTreatment);

            // 备注区域
            GroupBox gbRemarks = new GroupBox
            {
                Text = "备注",
                Location = new Point(10, 700),
                Size = new Size(940, 80)
            };

            TextBox txtRemarks = new TextBox
            {
                Location = new Point(10, 25),
                Size = new Size(920, 45),
                Multiline = true
            };

            gbRemarks.Controls.Add(txtRemarks);

            // 录入方式切换按钮
            Button btnSwitchInput = new Button
            {
                Text = "切换录入方式",
                Location = new Point(10, 790),
                Size = new Size(120, 30)
            };

            // 添加控件到选项卡
            tabVisit.Controls.AddRange(new Control[] {
                gbChiefComplaint,
                gbPresentIllness,
                gbPastHistory,
                gbPhysicalExam,
                gbAuxiliaryExam,
                gbDiagnosis,
                gbTreatment,
                gbRemarks,
                btnSwitchInput
            });
        }

        private void InitializeFollowUpTab()
        {
            // 随访记录区域
            GroupBox gbFollowUp = new GroupBox
            {
                Text = "随访记录",
                Location = new Point(10, 10),
                Size = new Size(940, 400)
            };

            TextBox txtFollowUp = new TextBox
            {
                Location = new Point(10, 25),
                Size = new Size(920, 365),
                Multiline = true
            };

            gbFollowUp.Controls.Add(txtFollowUp);

            // 随访模板选择
            GroupBox gbTemplate = new GroupBox
            {
                Text = "随访模板",
                Location = new Point(10, 420),
                Size = new Size(940, 60)
            };

            ComboBox cmbTemplate = new ComboBox
            {
                Location = new Point(10, 25),
                Size = new Size(920, 25),
                DropDownStyle = ComboBoxStyle.DropDownList
            };

            gbTemplate.Controls.Add(cmbTemplate);

            // 添加控件到选项卡
            tabFollowUp.Controls.AddRange(new Control[] {
                gbFollowUp,
                gbTemplate
            });
        }
    }
} 